! module *common_info*
!
! Purpose:
!   (1) provide common information to all other modules
!
! Author:
!   Name: DONG Li
!   Email: dongli@lasg.iap.ac.cn

module common_info

    implicit none

    character(50) :: input_file
    character(50) :: output_file

    logical, private :: initialized = .false.

    namelist /common_info_contents/ &
        input_file, output_file

contains

    subroutine common_info_init(namelist_file)
        character(*), intent(in) :: namelist_file

        if(initialized) return

        open(10, file=namelist_file)
        read(10, nml=common_info_contents)
        close(10)

        initialized = .true.

        return
    end subroutine common_info_init

    logical function common_info_is_initialized result(res)
        res = initialized
    end function common_info_is_initialized

end module common_info
